import requests

# 解决通过session+cookie认证方式
# 实例化session对象
session = requests.session()

# 1.获取图片验证码
session.get(url="http://hmshop-test.itheima.net/index.php?m=Home&c=User&a=verify")
# 2.发送登录请求
resp = session.post(url="http://hmshop-test.itheima.net/index.php?m=Home&c=User&a=do_login",
                    data={"username": "13800000001", "password": "123456", "verify_code": "8888"})
# 打印响应结果
print(resp.json())